
function IsValidEmail( email )
{
	var regex = /^([0-9A-Za-z\-_\.]+)@([0-9a-z\-]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g;
	if ( regex.test( email ) )
		return true;
	else
		return false;
}

function CheckValid()
{
	if ( document.getElementById("username").value == "" )
	{
		window.alert("账号不能为空");
		return false;
	}
	else if ( document.getElementById("nickname").value == "" )
	{
		window.alert("姓名不能为空");
		return false;
	}
	else if (document.getElementById("password").value == "" )
	{
		window.alert("密码不能为空");
		return false;
	}
	else if ( document.getElementById("password").value != document.getElementById("confirm").value )
	{
		window.alert("两次输入密码不同");
		return false;
	}
	else if ( document.getElementById("email").value != "" && !IsValidEmail( document.getElementById("email").value ) )
	{
		window.alert("电子邮件格式非法");
		return false;
	}
	else
		return true;
}